Learn R Programming

MXM (version 0.9.7)

Backward selection with generalised linear regression models: Variable selection in generalised linear regression models with backward selection

Description

Variable selection in generalised linear regression models with backward selection

Usage

glm.bsreg(target, dataset, threshold = 0.05, wei = NULL, heavy = FALSE, robust = FALSE)

Arguments

target
The class variable. Provide either an integer, a numeric value, or a factor. It can also be a matrix with two columns for the case of binomial regression. In this case, the first column is the nubmer of successes and the second column is the number of trials. See also the Details.
dataset
The dataset; provide either a data frame or a matrix (columns = variables, rows = observations). In either case, only two cases are avaialble, either all data are continuous, or categorical.
threshold
Threshold (suitable values in (0, 1)) for assessing p-values significance. Default value is 0.05.
wei
A vector of weights to be used for weighted regression. The default value is NULL. It is not suggested when robust is set to TRUE.
heavy
A boolean variable specifying whether heavy computations are required or not. If for exmaple the dataset contains tens of thousands of rows, it is advised to used memory efficient GLMs and hence set this to TRUE.
robust
A boolean variable which indicates whether (TRUE) or not (FALSE) to use a robust version of the statistical test if it is available. It takes more time than a non robust version but it is suggested in case of outliers. Default value is FALSE. Currently only the linear regression option is supported.

Value

The output of the algorithm is S3 object including: The output of the algorithm is S3 object including:

Details

This functions currently implements only linear, binomial, binary logistic and Poisson regression. If the sample size is less than the number of variables a meesage will appear and no backward regression is performed.

See Also

fs.reg, lm.fsreg, bic.fsreg, bic.glm.fsreg, CondIndTests, MMPC, SES

Examples

Run this code
set.seed(123)

#simulate a dataset with continuous data
dataset <- matrix( runif(1000 * 10, 1, 100), ncol = 10 )

#define a simulated class variable 
target <- rpois(1000, 10)
a <- glm.bsreg(target, dataset, threshold = 0.05) 

target <- rnorm(1000)
b <- glm.bsreg(target, dataset, threshold = 0.05)

target <- rbinom(1000, 1, 0.6)
d <- glm.bsreg(target, dataset, threshold = 0.05)

Run the code above in your browser using DataLab